<template>
  <div>
    <img id="img" src="./img1.jpg" alt="" />
  </div>
</template>

<script setup lang="ts">
// 引入 hooks
import useImgBase64 from './imgBase64'; // 返回一个函数即可

(async () => {
  const { base64Url } = await useImgBase64({ el: '#img' });
  console.log(base64Url);
})();
</script>

<style lang="scss" scoped>
img {
  width: 216px;
  height: 360px;
}
</style>
